﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <meta name="viewport" content="width=device-width" />
    <title></title>
</head>
<body>
    <link href="../../kindeditor/themes/default/default.css" rel="stylesheet" />
    <link href="../../kindeditor/plugins/code/prettify.css" rel="stylesheet" />
    <script src="../../kindeditor/kindeditor-all.js"></script>
    <script src="../../kindeditor/lang/zh-CN.js"></script>
    <script src="../../kindeditor/plugins/code/prettify.js"></script>
    <div>
        <div style="margin-left: auto; margin-right: auto;">
            <p style="font-size: 20px;">
                请选择您要管理的提示项：
        <input id="infoselect" name="dept" >
            </p>
            <textarea id="infoedit" cols="100" rows="8" style="width:950px;height:450px;visibility:hidden;" runat="server"></textarea>
            <br />
            <input type="submit" value="提交内容" onclick="Updata()" />
            <br />
        </div>
    </div>

    <script type="text/javascript">
        var editor1;
        var select;

        KindEditor.ready(function (K) {
              editor1 = K.create('#infoedit', {
                cssPath: '../../kindeditor/plugins/code/prettify.css',
                uploadJson: '../../kindeditor/asp.net/upload_json.ashx',
                fileManagerJson: '../../kindeditor/asp.net/file_manager_json.ashx',
                allowFileManager: true,
                allowMediaUpload:false,
                afterBlur: function () { this.sync(); }
            });
            prettyPrint();
        });

        $('#infoselect').combobox({
            url: '../admin/GetMenageType_json',
            valueField: 'ID',
            textField: 'title',
            onChange: function (newValue, oldValue) {
                select = newValue;
                $.post("/admin/GetInfomation", { "id": newValue },
                     function (data) {
                         if (data != "0") {
                             editor1.html(data);
                         } 
                     });
                
            } 
        });
        function Updata() {
            var text = editor1.html();
            if (select == 0)
            {
                alert("错误的提交！");
                return;
            }
            $.post("/admin/UpdataInfomation", { "id": select, "text": text },
                     function (data) {
                         if (data != "0") {
                             alert("修改成功！");
                         }
                         else
                             alert("修改失败！");
                     });
        }
    </script>
</body>
</html>
